package com.bh.config;

import com.bh.interceptor.FeignAuthlnterceptor;
import feign.Logger;
import feign.Request;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import feign.auth.BasicAuthRequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.support.BasicAuthenticationInterceptor;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;

/**
 * @author Wang
 * @version 1.0
 * @date 2022/6/8 20:28
 */

@Configuration
public class FeiginConfig {
    @Bean
    Logger.Level Level(){
        return Logger.Level.FULL;
    }

    @Bean
    public BasicAuthRequestInterceptor basicAuthRequestInterceptor(){
        return new BasicAuthRequestInterceptor("admin","admin");
    }

    @Bean
    public RequestInterceptor feignAuthInterceptor(){
        return new FeignAuthlnterceptor();
    }

    @Bean       //超时时间设置
    public Request.Options options(){
        return new Request.Options();
    }
}
